export default {
    namespaced: true,
    state: {
        isShowToast: false,
        msg:"",
        // warning 警告
        // success 成功
        // danger 失败
        type:''
    },
    mutations: {
        chanIsShowToast(state,playload){
            state.isShowToast = !state.isShowToast
            state.msg=playload.msg
            state.type=playload.type
        }

    },
    actions:{
        asynChanIsShowToast({commit},playload){
            //先显示
            commit("chanIsShowToast",{
                msg:playload.msg,
                type:playload.type
            })

            //再隐藏
            setTimeout(() => {
                commit('chanIsShowToast',{
                    msg:playload.msg,
                    type:playload.type
                })
            }, 1500);
        }
    }
   
}